<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ include file="/taglibs.jsp"%>
<%@taglib uri="/WEB-INF/tld/pageutil.tld" prefix="pu"%>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt"%>
<%@page import="com.yaodian100.core.common.utils.ServerValue"%>
<c-rt:set var="midContextPath" value='<%=ServerValue.getMidContextPath()%>'/>
<!-- 地址选单 -->
<script type="text/javascript" charset="UTF-8" src="/genJS/yaodian_zipcodeMidend.js"></script>
<script type="text/javascript" charset="UTF-8" src="/js/jquery.cascade.ext.js"></script>
<script type="text/javascript" charset="UTF-8" src="/js/jquery.cascade.js"></script>
<script type="text/javascript" charset="UTF-8" src="/js/jquery.templating.js"></script>
<script type="text/javascript" charset="UTF-8" src="/js/jquery.alphanumeric.js"></script>

<c-rt:if test="${!empty param.supplierID}">
<c-rt:set var="supplier" value="${pu:get('com.yaodian100.ec.supplierapply.entity.SupplierApply', param.supplierID)}"/>
</c-rt:if> 
<c-rt:set var="params" value="${pu:addToList('paras', 'Supplier.area')}"/>
<c-rt:set var="areas" value="${pu:queryByHql('from Option where menu.key=? order by sortOrder', params, null)}"/>

<c-rt:set var="params2" value="${pu:addToList('paras2', 'Supplier.paymentTerm')}"/>
<c-rt:set var="paymentTerms" value="${pu:queryByHql('from Option where menu.key=? order by sortOrder', params2, null)}"/>

<c-rt:set var="params3" value="${pu:addToList('paras3', 'Common.Currency')}"/>
<c-rt:set var="currencys" value="${pu:queryByHql('from Option where menu.key=? order by sortOrder', params3, null)}"/>

<c-rt:set var="params4" value="${pu:addToList('paras4', 'Common.Incoterm')}"/>
<c-rt:set var="incoterms" value="${pu:queryByHql('from Option where menu.key=? order by sortOrder', params4, null)}"/>
${pu:listAdd('params5', 'Supplier.taxInvoice') }
${pu:reqSet('taxInvoices', pu:queryByHql('from Option where menu.key=? order by sortOrder', pu:arrayGet('params5'), null))}
	<script language="javascript">
	$(document).ready( function() {
		$("#shipZip").numeric();
		$("#boToWHDate").numeric();
		<c-rt:if test="${empty supplier or supplier.isSelfShip eq 'N'}">
			$("#divReturnInfo1").hide();
			$("#divReturnInfo2").hide();
			$("#divReturnInfo3").hide();
			$("#divReturnInfo4").hide();
		</c-rt:if>
		$.each(provinceArray,function(index, item){
		    $("#province").append("<option value='" + item.Value + "'>" + item.Text + "</option>"); //发货地址
		    $("#coprovince").append("<option value='" + item.Value + "'>" + item.Text + "</option>"); //供应商地址
		    $("#returnProvince").append("<option value='" + item.Value + "'>" + item.Text + "</option>"); //退(换)货地址
		  });
			jQuery("#city").cascade("#province",{//发货地址					
				list : cityArray,				
				template: commonTemplate,
				match: commonMatch 
			});
			jQuery("#cocity").cascade("#coprovince",{//供应商地址					
				list : cityArray,				
				template: commonTemplate,
				match: commonMatch 
			});
			jQuery("#returnCity").cascade("#returnProvince",{//退(换)货地址					
				list : cityArray,				
				template: commonTemplate,
				match: commonMatch 
			});
			jQuery("#district").cascade("#city",{//发货地址					
				list: districtArray,
				template: commonTemplate,
				match: commonMatch 
			});
			jQuery("#codistrict").cascade("#cocity",{//供应商地址					
				list: districtArray,
				template: commonTemplate,
				match: commonMatch 
			});
			jQuery("#returnArea").cascade("#returnCity",{//退(换)货地址						
				list: districtArray,
				template: commonTemplate,
				match: commonMatch 
			});
			
			if ( $("#supplierID").val() != "" ){
				$.each(provinceArray,function(index, item){//发货地址
					if ( item.Value == "${supplier.shipProvince}" ){
						$("#province").attr("selectedIndex",index+1);
					}
				});
				$.each(provinceArray,function(index, item){//供应商地址
					if ( item.Value == "${supplier.companyProvince}" ){
						$("#coprovince").attr("selectedIndex",index+1);
					}
				});
				$.each(provinceArray,function(index, item){//退(换)货地址
					if ( item.Value == "${supplier.returnProvince}" ){
						$("#returnProvince").attr("selectedIndex",index+1);
					}
				});
				
				$.each(cityArray,function(index, item){//发货地址
					if ( item.When == "${supplier.shipProvince}" ){
						$("#city").append("<option value='" + item.Value + "'>" + item.Text + "</option>");
					}
				});
				$.each(cityArray,function(index, item){//供应商地址
					if ( item.When == "${supplier.companyProvince}" ){
						$("#cocity").append("<option value='" + item.Value + "'>" + item.Text + "</option>");
					}
				});
				$.each(cityArray,function(index, item){//退(换)货地址
					if ( item.When == "${supplier.returnProvince}" ){
						$("#returnCity").append("<option value='" + item.Value + "'>" + item.Text + "</option>");
					}
				});
				
				var newCityArray = jQuery.grep(cityArray, function (item) { return item.When == "${supplier.shipProvince}"; });//发货地址
				var newCityArrayCo = jQuery.grep(cityArray, function (item) { return item.When == "${supplier.companyProvince}"; });//供应商地址
				var newCityArrayReturn = jQuery.grep(cityArray, function (item) { return item.When == "${supplier.returnProvince}"; });//退(换)货地址
				$.each(newCityArray,function(index, item){//发货地址
					if ( item.Value == "${supplier.shipCity}" ){
						$("#city").attr("selectedIndex",index+1);
					}
				});
				$.each(newCityArrayCo,function(index, item){//供应商地址
					if ( item.Value == "${supplier.companyCity}" ){
						$("#cocity").attr("selectedIndex",index+1);
					}
				});
				$.each(newCityArrayReturn,function(index, item){//退(换)货地址
					if ( item.Value == "${supplier.returnCity}" ){
						$("#returnCity").attr("selectedIndex",index+1);
					}
				});
				$.each(districtArray,function(index, item){//发货地址
					if ( item.When == "${supplier.shipCity}" ){
						$("#district").append("<option value='" + item.Value + "'>" + item.Text + "</option>");
					}
				});
				$.each(districtArray,function(index, item){//供应商地址
					if ( item.When == "${supplier.companyCity}" ){
						$("#codistrict").append("<option value='" + item.Value + "'>" + item.Text + "</option>");
					}
				});
				$.each(districtArray,function(index, item){//退(换)货地址
					if ( item.When == "${supplier.returnCity}" ){
						$("#returnArea").append("<option value='" + item.Value + "'>" + item.Text + "</option>");
					}
				});
				
				newDistrictArray = jQuery.grep(districtArray, function (item) { return item.When == "${supplier.shipCity}"; });//发货地址
				newDistrictArrayCo = jQuery.grep(districtArray, function (item) { return item.When == "${supplier.companyCity}"; });//供应商地址
				newDistrictArrayReturn = jQuery.grep(districtArray, function (item) { return item.When == "${supplier.returnCity}"; });//退(换)货地址
				$.each(newDistrictArray,function(index, item){//发货地址
					if ( item.Value == "${supplier.shipArea}" ){
						$("#district").attr("selectedIndex",index+1);
					}
				});
				$.each(newDistrictArrayCo,function(index, item){//供应商地址
					if ( item.Value == "${supplier.companyArea}" ){
						$("#codistrict").attr("selectedIndex",index+1);
					}
				});
				$.each(newDistrictArrayReturn,function(index, item){//退(换)货地址
					if ( item.Value == "${supplier.returnArea}" ){
						$("#returnArea").attr("selectedIndex",index+1);
					}
				});
			}

			$(":input[name='coprovince']").change(function(){
				$.post("<%=ServerValue.getMidContextPath()%>/supplierApply/bodate.do",{coprovince:$("#coprovince").val()},callback,"json");
				function callback(result){
					$("#boToWHDate").val(result)
				}
			});

		$('#saContactName').click(function(){
			 if (this.checked){
				 $('#serviceName').val($('#contactName').val());
			 }else{
				 $('#serviceName').val('');
			 }
		});
		$('#saContactPhone').click(function(){
			if (this.checked){
				 $('#servicePhone').val($('#contactPhone').val());
			 }else{
				 $('#servicePhone').val('');
			 }
		});
		$('#saContactFax').click(function(){
			if (this.checked){
				 $('#serviceFax').val($('#contactFax').val());
			 }else{
				 $('#serviceFax').val('');
			 }
		});
		$('#saContactAddress').click(function(){
			if (this.checked){
				 $('#serviceAddress').val($('#contactAddress').val());
			 }else{
				 $('#serviceAddress').val('');
			 }
		});
		$('#saContactEmail').click(function(){
			if (this.checked){
				 $('#serviceEmail').val($('#contactEmail').val());
			 }else{
				 $('#serviceEmail').val('');
			 }
		});

		$('#shContactName').click(function(){
			 if (this.checked){
				 $('#shipContact').val($('#contactName').val());
			 }else{
				 $('#shipContact').val('');
			 }
		});

		$('#shContactPhone').click(function(){
			if (this.checked){
				 $('#shipPhone').val($('#contactPhone').val());
			 }else{
				 $('#shipPhone').val('');
			 }
		});
		$('#shContactAddress').click(function(){
			if (this.checked){
				 $('#shipAddr').val($('#contactAddress').val());
			 }else{
				 $('#shipAddr').val('');
			 }
		});

		//退(换)货联络窗口
		$('#sarContactName').click(function(){
			 if (this.checked){
				 $('#returnContact').val($('#contactName').val());
			 }else{
				 $('#returnContact').val('');
			 }
		});
		//退(换)货联络窗口电话
		$('#sarContactPhone').click(function(){
			if (this.checked){
				 $('#returnPhone').val($('#contactPhone').val());
			 }else{
				 $('#returnPhone').val('');
			 }
		});
		//退(换)货地址
		$('#sarContactAddress').click(function(){
			if (this.checked){
				 $('#returnAddr').val($('#contactAddress').val());
			 }else{
				 $('#returnAddr').val('');
			 }
		});

		//退(换)货发货联络窗口
		$('#saShipContactName').click(function(){
			 if (this.checked){
				 $('#returnContact').val($('#shipContact').val());
			 }else{
				 $('#returnContact').val('');
			 }
		});
		//退(换)货发货联络窗口电话
		$('#saShipContactPhone').click(function(){
			if (this.checked){
				 $('#returnPhone').val($('#shipPhone').val());
			 }else{
				 $('#returnPhone').val('');
			 }
		});
		//退(换)货发货地址
		$('#saShipContactAddress').click(function(){
			if (this.checked){
				 $('#returnAddr').val($('#shipAddr').val());
				 $('#returnZip').val($('#shipZip').val());
				 $("#returnProvince").children().each(function(){
						if ($(this).text() == $('select#province option:selected').text()){
							$(this).attr("selected","true"); 
							queryProvince2($('select#city option:selected').val(),$('select#district option:selected').val());
						}
				 });
			
			 }else{
				 $('#returnAddr').val('');
			 }
		});

		$('#isSelfShipY').click(function(){	
			 $("#divReturnInfo1").show();
			 $("#divReturnInfo2").show();
			 $("#divReturnInfo3").show();
			 $("#divReturnInfo4").show();
		});	

		$('#isSelfShipN').click(function(){	
			 $("#divReturnInfo1").hide();
			 $("#divReturnInfo2").hide();
			 $("#divReturnInfo3").hide();
			 $("#divReturnInfo4").hide();
		});			
		
		$('#submit_button').click(function(){
			message='';
			if ( $("#pm").val() == ""){
				message+='请选择开发PM\r\n';
			}
			if(document.applyForm.companyName.value==''){
				message+='请填供应商名称\r\n';
			}
			if(document.applyForm.companyNum.value==''){
				message+='请填供应商统编\r\n';
			}
			if(document.applyForm.companyPhone.value==''){
				message+='请填供应商电话\r\n';
			}
			if(document.applyForm.coprovince.value=='== 选择省 =='){
				message+='请填供应商地址省份\r\n';
			}
			if(document.applyForm.cocity.value=='== 选择城市 =='){
				message+='请填供应商地址市\r\n';
			}
			if(document.applyForm.codistrict.value=='== 选择地区 =='){
				message+='请填供应商地址区\r\n';
			}
			if(document.applyForm.cozip.value==''){
				message+='请填供应商地址邮编\r\n';
			}
			if(document.applyForm.companyAddress.value==''){
				message+='请填供应商地址街道\r\n';
			}
			if(document.applyForm.boToWHDate.value==''){
				message+='请填BO到仓天数\r\n';
			}
			if ($('input[id=poTypeO]').is(":checked") == false  && $('input[id=poTypeV]').is(":checked") == false && $('input[id=poTypeOV]').is(":checked") == false){
				message+='请输入采购类别\r\n';
			}
			if(document.applyForm.contactName.value==''){
				message+='请填联络人姓名\r\n';
			}
			if(document.applyForm.contactPhone.value==''){
				message+='请填联络人电话\r\n';
			}
			if(document.applyForm.contactEmail.value==''){
				message+='请填联络人Email\r\n';
			}else if(!validateEmail(document.applyForm.contactEmail.value)){
				message+='Email格式有误\r\n';
			}
			if(document.applyForm.bankName){
				if(document.applyForm.bankName.value==''){
					message+='请填开户银行\r\n';
				}
			}
			if(document.applyForm.bankAccountName){
				if(document.applyForm.bankAccountName.value==''){
					message+='请填开户名称\r\n';
				}
			}
			if(document.applyForm.bankAccountNum){
				if(document.applyForm.bankAccountNum.value==''){
					message+='请填银行账号\r\n';
				}
				if(!isNumber(document.applyForm.bankAccountNum.value)){
					message+='银行账号请填写数字\r\n';
				}
			}
			if(document.applyForm.taxInvoice.value==''){
				message+='请选择纳税人性质／发票性质\r\n';
			}

			if(document.applyForm.shipContact.value==''){
				message+='请填发货联络人姓名\r\n';
			}
			if(document.applyForm.province.value=='== 选择省 =='){
				message+='请填省份\r\n';
			}
			if(document.applyForm.city.value=='== 选择城市 =='){
				message+='请填市\r\n';
			}
			if(document.applyForm.district.value=='== 选择地区 =='){
				message+='请填区\r\n';
			}
			if(document.applyForm.shipZip.value==''){
				message+='请填邮编\r\n';
			}
			if(document.applyForm.shipAddr.value==''){
				message+='请填街道\r\n';
			}
			if(document.applyForm.shipPhone.value==''){
				message+='请填發貨聯絡電話\r\n';
			}

			if(document.applyForm.paymentTerm.value==''){
				message+='请选择PaymentTerm\r\n';
			}
			if(document.applyForm.paymentCurrency.value==''){
				message+='请选择币别\r\n';
			}
			<c-rt:if test="${empty supplier}">
				if(document.applyForm.paymentBankArea.value==''){
					message+='请选择付款银行所在地\r\n';
				}
			</c-rt:if>
			if(message!=''){
				alert(message);
				if ( $("#pm").val() == ""){
					$("#pm").focus();
				}
				if($("#companyName").val() ==''){
					$("#companyName").focus();
				}
				if($("#paymentTerm").val() ==''){
					$("#paymentTerm").focus();
				}

				if($("#companyNum").val() ==''){
					$("#companyNum").focus();
				}
				if($("#companyPhone").val() ==''){
					$("#companyPhone").focus();
				}
				if($("#coprovince").val()=='== 选择省 =='){
					$("#coprovince").focus();
				}
				if($("#cocity").val()=='== 选择城市 =='){
					$("#cocity").focus();
				}
				if($("#codistrict").val()=='== 选择地区 =='){
					$("#codistrict").focus();
				}
				if($("#cozip").val()==''){
					$("#cozip").focus();
				}
				if($("#companyAddress").val()==''){
					$("#companyAddress").focus();
				}
				if($("#boToWHDate").val()==''){
					$("#boToWHDate").focus();
				}
				if ($('input[id=poTypeO]').is(":checked") == false  && $('input[id=poTypeV]').is(":checked") == false && $('input[id=poTypeOV]').is(":checked") == false){
					$("#poTypeO").focus();
				}
				if($("#contactName").val()==''){
					$("#contactName").focus();
				}
				if($("#contactPhone").val()==''){
					$("#contactPhone").focus();
				}
				if($("#contactEmail").val()==''){
					$("#contactEmail").focus();
				}else if(!validateEmail($("#contactEmail").val())){
					$("#contactEmail").focus();
				}
				if(document.applyForm.bankName){
					if($("#bankName").val()==''){
						$("#bankName").focus();
					}
				}
				if(document.applyForm.bankAccountName){
					if($("#bankAccountName").val()==''){
						$("#bankAccountName").focus();
					}
				}
				if(document.applyForm.bankAccountNum){
					if($("#bankAccountNum").val()==''){
						$("#bankAccountNum").focus();
					}
					if(!isNumber($("#bankAccountNum").val())){
						$("#bankAccountNum.").focus();
					}
				}
				if($("#taxInvoice").val()==''){
					$("#taxInvoice").focus();
				}

				if($("#shipContact").val()==''){
					$("#shipContact").focus();
				}
				if($("#province").val()=='== 选择省 =='){
					$("#province").focus();
				}
				if($("#city").val()=='== 选择城市 =='){
					$("#city").focus();
				}
				if($("#district").val()=='== 选择地区 =='){
					$("#district").focus();
				}
				if($("#shipZip").val()==''){
					$("#shipZip").focus();
				}
				if($("#shipAddr").val()==''){
					$("#shipAddr").focus();
				}
				if($("#shipPhone").val()==''){
					$("#shipPhone").focus();
				}

				if($("#paymentCurrency").val()==''){
					$("#paymentCurrency").focus();
				}
				<c-rt:if test="${empty supplier}">
					if($("#paymentBankArea").val()==''){
						$("#paymentBankArea").focus();
					}
				</c-rt:if>
				
			}else{
				if($('input[id=isSelfShipY]').is(":checked")){
					if($('input[id=isScmN]').is(":checked")){
						alert('供应商为转单，才可设定自行配送');
						return false;
					}
				}
				<c-rt:if test="${!empty supplier}">
				if(chkReturnInfo()){
					if(confirmation()){
							doAR('<%=application.getContextPath() %>/supplierApply/apply.do', 'main', 'applyForm');
						}else{
							return false;
						}
					}else{
						if($('input[id=isReturnSupplierY]').is(":checked")){
							if($('input[id=isSelfShipY]').is(":checked")){
								if($("#returnProvince").val()=='== 选择省 =='){			
									$("#returnProvince").focus();
								}	
								if($("#returnCity").val()=='== 选择城市 =='){			
									$("#returnCity").focus();
								}	
								if($("#returnArea").val()=='== 选择地区 =='){			
									$("#returnArea").focus();
								}	
								if($("#returnAddr").val()=='' ){			
									$("#returnAddr").focus();
								}	
								if($("#returnZip").val()=='' ){			
									$("#returnZip").focus();
								}	
								if($("#returnContact").val()==''){			
									$("#returnContact").focus();
								}	
								if($("#returnPhone").val()==''){	
									
									$("#returnPhone").focus();
								}
							}								
						}
						return false;
					}
				</c-rt:if>

				<c-rt:if test="${empty supplier}">
				if(chkReturnInfo()){
					doAR('<%=application.getContextPath() %>/supplierApply/apply.do', 'main', 'applyForm');
				}else{
					return false;
				}
				</c-rt:if>
				
			}
		});
	});

	function isNumber(val){
		var reg = /^[0-9]*$/;
		return reg.test(val);
	}

	function commonTemplate(item) {
		return "<option value='" + item.Value + "'>" + item.Text + "</option>"; 
	}
	
	function commonMatch(selectedValue) {
		return this.When == selectedValue; 
	}
	function confirmation() {
		if($('input[id=isScmN]').is(":checked")){ 
			var answer = confirm("供应商的所有转单商品将设为BO?");
			if (answer){
				return true;
			}
			else{
				return false;
			}
		}else{
			return true;
		}
	}

	function chkReturnInfo(){
		if($('input[id=isReturnSupplierY]').is(":checked")){
			if($('input[id=isSelfShipY]').is(":checked")){
				if(document.applyForm.returnProvince.value=='== 选择省 =='||
						document.applyForm.returnCity.value=='== 选择城市 =='||
						document.applyForm.returnArea.value=='== 选择地区 =='||
						document.applyForm.returnAddr.value=='' ||document.applyForm.returnZip.value=='' ||
						document.applyForm.returnContact.value==''||
						document.applyForm.returnPhone.value==''){			
					alert("退(换)货联络资讯需填完整");
					return false;
				}else{
					return true;
				}
			}else{
				return true;
			}
		}else{
			return true;
		}	
	}


	
	//查詢province ajax
	function queryProvince2(adCity,adDistrict){
		var province=$('select#province option:selected').val();
		if ( "" != province ){
					$.each(cityArray,function(index2, item2){//退(换)货地址
						if ( item2.When == $('select#returnProvince option:selected').val() ){
							$("#returnCity").append("<option value='" + item2.Value + "'>" + item2.Text + "</option>");
						}
					});
					var newCityArrayReturn2 = jQuery.grep(cityArray, function (item2) { return item2.When == $('select#returnProvince option:selected').val(); });//退(换)货地址
					$.each(newCityArrayReturn2,function(index2, item2){//退(换)货地址
						if ( item2.Value == adCity ){
							//$("#returnCity").html("");
							$("#returnCity").html($("#city").html());
							if($('select#returnCity option:0').val()=='== 选择城市 =='){
								$("#returnCity").attr("selectedIndex",index2+1);
							}else{
								$("#returnCity").attr("selectedIndex",index2);
							}
						}
					});
					$.each(districtArray,function(index2, item2){//退(换)货地址
						if ( item2.When == adCity ){
							$("#returnArea").append("<option value='" + item2.Value + "'>" + item2.Text + "</option>");
						}
					});
					newDistrictArrayReturn2 = jQuery.grep(districtArray, function (item2) { return item2.When == adCity; });//退(换)货地址
					$.each(newDistrictArrayReturn2,function(index2, item2){//退(换)货地址
						if ( item2.Value == adDistrict ){
							//$("#returnArea").html("");
							$("#returnArea").html($("#district").html());
							if($('select#returnArea option:0').val()=='== 选择地区 =='){
								$("#returnArea").attr("selectedIndex",index2+1);
							}else{
								$("#returnArea").attr("selectedIndex",index2);
							}
						}
					});
		}
	}	
	</script>

<s:actionerror/>
<s:actionmessage/>
<s:fielderror />
<br/>
<h1>供应商管理</h1>
<div class="f-link">
	<a href="${midContextPath}/supplierApply/page.do?iamlazy=list">回查询页</a>
</div>
<c-rt:if test="${!empty param.operation}">
	<c-rt:if test="${empty supplier}">
	<span style="color:red">已储存！</span>
	</c-rt:if>
	<c-rt:if test="${!empty supplier}">
	<span style="color:red">已储存修改！</span>
	</c-rt:if>
</c-rt:if>
<form method="post" id="applyForm" name="applyForm">
<c-rt:if test="${empty supplier}">
<input type="hidden" name="operation" value="save"/>
</c-rt:if>
<c-rt:if test="${!empty supplier}">
<input type="hidden" name="operation" value="update"/>
</c-rt:if>
<table class="tb-data" width="100%">
<tr><th width="130px">供应商代码</th><td>${supplier.supplierID}<input type="hidden" name="supplierID" value="${supplier.supplierID }"/></td>
	<th width="150px"><span style="color:red">*</span>开发PM</th>	<td colspan="3"><s:select id="pm" name="pm" list="users" listKey="username"  listValue="nameNative" headerKey="" headerValue="--请选择--"/></td>
</tr>
<tr><th><span style="color:red">*</span>供应商名称</th><td><input size="50" type="text" id="companyName" name="companyName" value="${supplier.companyName }" maxlength="80"/>最多80个字</td>
	<th><span style="color:red">*</span>供应商营业执照注册号</th><td><input size="50" type="text" id="companyNum" name="companyNum" value="${supplier.companyNum}" maxlength="35"/><br/>最多35个字</td></tr>

<tr><th><span style="color:red">*</span>供应商电话</th><td><input size="50" type="text" id="companyPhone" name="companyPhone" value="${supplier.companyPhone}" maxlength="50"/>最多50个字</td>
	<th>供应商传真</th><td><input size="50" type="text" name="companyFax" value="${supplier.companyFax}" maxlength="50"/><br/>最多50个字</td></tr>
<tr><th><span style="color:red">*</span>供应商地址</th>
<td  colspan="3">
<span style="color:red">*</span>省份：<select id="coprovince" name="coprovince" class="c-prov"><option>== 选择省 ==</option></select>
<span style="color:red">*</span>市：<select id="cocity" name="cocity"><option>== 选择城市 ==</option></select>
<span style="color:red">*</span>区：<select id="codistrict" name="codistrict"><option>== 选择地区 ==</option></select><br />
<span style="color:red">*</span>邮编：<input type="text" name="cozip" id="cozip" value="${supplier.companyZip}" size="6" maxlength="6">
<input size="80" type="text" id="companyAddress" name="companyAddress" value="${supplier.companyAddress}" maxlength="80"/>最多80个字
</td></tr>
<tr><th><span style="color:red">*</span>BO到仓天数</th><td><input size="5" type="text" id="boToWHDate" name="boToWHDate" value="${supplier.boToWHDate}" maxlength="5"/></td>
	<th><span style="color:red">*</span>采购类别</th><td>
	<input id="poTypeO" name="poType" type="radio" value="O" <c-rt:if test="${supplier.boPoType eq 'O'}">checked="checked"</c-rt:if>/>买断
	<input id="poTypeV" name="poType" type="radio" value="V" <c-rt:if test="${supplier.boPoType eq 'V'}">checked="checked"</c-rt:if>/>寄售
	<input id="poTypeOV" name="poType" type="radio" value="OV" <c-rt:if test="${supplier.boPoType eq 'OV'}">checked="checked"</c-rt:if>/>买断、寄售
</td></tr>
<tr><th>负责人姓名</th><td><input size="50" type="text" name="ownerName" value="${supplier.ownerName}" maxlength="30"/>最多30个字</td>
	<th>负责人身分证</th><td><input size="50" type="text" name="ownerID" value="${supplier.ownerID}" maxlength="20"/><br/>最多20个字</td></tr>
<tr><th><span style="color:red">*</span>纳税人性质／发票性质</th><td>
	<select name="taxInvoice" id="taxInvoice">
	<option value="">请选择</option>
	<c-rt:forEach items="${taxInvoices }" var="ti">
	<option value="${ti.code }" <c-rt:if test="${ti.code==supplier.taxInvoice }">selected="selected"</c-rt:if>>${ti.name }</option>
	</c-rt:forEach>
	</select></td>
	<th>产业别</th><td><input size="50" type="text" name="industry" value="${supplier.industry}" maxlength="30"/><br/>最多30个字</td>
</tr>
<tr><th>发票抬头</th><td><input size="50" type="text" name="invoiceTitle" value="${supplier.invoiceTitle}" maxlength="50"/>最多50个字</td>
	<th>发票地址</th><td><input size="80" type="text" name="invoiceAddress" value="${supplier.invoiceAddress}" maxlength="80"/>最多80个字</td>
</tr>
<tr><th><span style="color:red">*</span>联络人</th><td><input size="50" type="text" name="contactName" id="contactName" value="${supplier.contactName}" maxlength="50"/>最多50个字</td>
	<th><span style="color:red">*</span>联络人电话</th><td><input size="50" type="text" name="contactPhone" id="contactPhone" value="${supplier.contactPhone}" maxlength="50"/><br/>最多50个字</td>
</tr>
<tr><th>联络人传真</th><td><input size="50" type="text" name="contactFax" id="contactFax" value="${supplier.contactFax}" maxlength="50"/>最多50个字</td>
	<th>联络人地址</th><td><input size="80" type="text" name="contactAddress" id="contactAddress" value="${supplier.contactAddress}" maxlength="80"/>最多80个字</td>
</tr>
<tr><th><span style="color:red">*</span>联络人Email</th><td colspan="3"><input size="80" type="text" id="contactEmail" name="contactEmail" value="${supplier.contactEmail}" maxlength="100"/>最多100个字</td></tr>
<tr><th>维修窗口</th><td><input type=checkbox name="saContactName" id="saContactName" />同联络人窗口<br/><input size="50" type="text" id="serviceName" name="serviceName" value="${supplier.serviceName}" maxlength="50"/>最多50个字</td>
	<th>维修窗口电话</th><td><input type=checkbox name="saContactPhone" id="saContactPhone" />同联络人电话<br/><input size="50" type="text" id="servicePhone" name="servicePhone" value="${supplier.servicePhone}" maxlength="50"/><br/>最多50个字</td>
</tr>
<tr><th>维修窗口传真</th><td><input type=checkbox name="saContactFax" id="saContactFax" />同联络人传真<br/><input size="50" type="text" id="serviceFax" name="serviceFax" value="${supplier.serviceFax}" maxlength="50"/>最多50个字</td>
	<th>维修窗口地址</th><td><input type=checkbox name="saContactAddress" id="saContactAddress" />同联络人地址<br/><input size="80" type="text" id="serviceAddress" name="serviceAddress" value="${supplier.serviceAddress}" maxlength="80"/>最多80个字</td>
</tr>
<tr><th>维修窗口Email</th><td colspan="3"><input type=checkbox name="saContactEmail" id="saContactEmail" />同联络人Email<br/><input size="80" type="text" id="serviceEmail" name="serviceEmail" value="${supplier.serviceEmail}" maxlength="100"/>最多100个字</td></tr>
<tr><th>维修时间</th><td colspan="3"><input size="30" type="text" name="serviceHours" value="${supplier.serviceHours}" maxlength="50"/>最多50个字</td></tr>
<tr><th>维修说明</th><td colspan="3"><textarea rows="5" cols="60" name="serviceHours">${supplier.serviceMemo}</textarea></td></tr>
<tr><th><span style="color:red">*</span>发货联络人</th><td colspan="3"><input type=checkbox name="shContactName" id="shContactName" />同联络人窗口<br/><input size="50" type="text" name="shipContact" id="shipContact" value="${supplier.shipContact}" maxlength="20"/>最多20个字</td></tr>
<tr><th><span style="color:red">*</span>发货地址：</th><td colspan="3">
<span style="color:red">*</span>省份：<select id="province" name="province" class="c-prov"><option>== 选择省 ==</option></select>
<span style="color:red">*</span>市：<select id="city" name="city"><option>== 选择城市 ==</option></select>
<span style="color:red">*</span>区：<select id="district" name="district"><option>== 选择地区 ==</option></select><br />
<input type=checkbox name="shContactAddress" id="shContactAddress" />同联络人地址<br/>
<span style="color:red">*</span>邮编：<input type="text" name="shipZip" id="shipZip" value="${supplier.shipZip}" size="6" maxlength="6">
<INPUT size="50" id="shipAddr" name="shipAddr" value="${supplier.shipAddr}" maxlength="100"/>最多100个字</td></tr>
<tr><th><span style="color:red">*</span>发货联络电话：</th><td colspan="3"><input type=checkbox name="shContactPhone" id="shContactPhone" />同联络人电话<br/><INPUT size="50" id="shipPhone" name="shipPhone" value="${supplier.shipPhone}" maxlength="50"/>最多50个字</td></tr>
<tr><th><span style="color:red">*</span>是否转单</th><td>
		<input id="isScmY" name="isScm" type="radio" value="Y" <c-rt:if test="${supplier.isScm eq 'Y'}">checked="checked"</c-rt:if>/>是
		<input id="isScmN" name="isScm" type="radio" value="N" <c-rt:if test="${empty supplier.isScm or supplier.isScm eq 'N'}">checked="checked"</c-rt:if>/>否
	</td>
</tr>	
<tr><th><span style="color:red">*</span>是否自行配送</th><td colspan="3">
	<input id="isSelfShipY" name="isSelfShip" type="radio" value="Y" <c-rt:if test="${supplier.isSelfShip eq 'Y'}">checked="checked"</c-rt:if>/>是
	<input id="isSelfShipN" name="isSelfShip" type="radio" value="N" <c-rt:if test="${empty supplier.isSelfShip or supplier.isSelfShip eq 'N'}">checked="checked"</c-rt:if>/>否
</td></tr>
		<tr id="divReturnInfo1"><th><span style="color:red">*</span>是否直退／换</th><td colspan="3">
			<input id="isReturnSupplierY" name="isReturnSupplier" type="radio" value="Y" <c-rt:if test="${supplier.isReturnSupplier eq 'Y'}">checked="checked"</c-rt:if>/>是
			<input id="isReturnSupplierN" name="isReturnSupplier" type="radio" value="N" <c-rt:if test="${empty supplier.isReturnSupplier or supplier.isReturnSupplier eq 'N'}">checked="checked"</c-rt:if>/>否
			<span style="color:red">选择是直退／换，则退(换)货资料为必填</span>
		</td></tr>
		<tr id="divReturnInfo2"><th>退(换)货联络窗口</th><td colspan="3"><input type=checkbox name="sarContactName" id="sarContactName" />同联络人窗口
		<input type=checkbox name="saShipContactName" id="saShipContactName" />同发货联络人窗口
		<br/>
		<input size="50" type="text" name="returnContact" id="returnContact" value="${supplier.returnContact}" maxlength="20"/>最多20个字</td></tr>
		<tr id="divReturnInfo3"><th>退(换)货地址：</th><td colspan="3">
		<span style="color:red">*</span>省份：<select id="returnProvince" name="returnProvince" class="c-prov"><option>== 选择省 ==</option></select>
		<span style="color:red">*</span>市：<select id="returnCity" name="returnCity"><option>== 选择城市 ==</option></select>
		<span style="color:red">*</span>区：<select id="returnArea" name="returnArea"><option>== 选择地区 ==</option></select><br />
		<input type=checkbox name="sarContactAddress" id="sarContactAddress" />同联络人地址
		<input type=checkbox name="saShipContactAddress" id="saShipContactAddress" />同发货联络人地址<br/>
		<span style="color:red">*</span>邮编：<input type="text" name="returnZip" id="returnZip" value="${supplier.returnZip}" size="6" maxlength="6">
		<INPUT size="50" id="returnAddr" name="returnAddr" value="${supplier.returnAddr}" maxlength="100"/>最多100个字</td></tr>
		<tr id="divReturnInfo4"><th>退(换)货联络窗口电话：</th><td colspan="3"><input type=checkbox name="sarContactPhone" id="sarContactPhone" />同联络人电话
		<input type=checkbox name="saShipContactPhone" id="saShipContactPhone" />同发货联络人电话
		<br/><INPUT size="50" id="returnPhone" name="returnPhone" value="${supplier.returnPhone}" maxlength="50"/>最多50个字</td></tr>
<tr><th>Group</th><td colspan="3"><input size="50" type="text" name="groupName" value="${supplier.groupName}" maxlength="50"/>最多50个字</td></tr>
<tr><th><span style="color:red">*</span>PaymentTerm</th><td>
<select name="paymentTerm" id="paymentTerm">
	<option value="">please select</option>
	<c-rt:forEach items="${paymentTerms }" var="paymentTerm">
		<option value="${paymentTerm.code }" <c-rt:if test="${paymentTerm.code==supplier.paymentTerm }">selected="selected"</c-rt:if>>${paymentTerm.name }</option>
	</c-rt:forEach>
</select>
</td>
<th><span style="color:red">*</span>币别</th><td>
<select name="paymentCurrency" id="paymentCurrency">
	<option value="">please select</option>
	<c-rt:forEach items="${currencys }" var="currency">
		<option value="${currency.code }" <c-rt:if test="${currency.code==supplier.paymentCurrency }">selected="selected"</c-rt:if>>${currency.name }</option>
	</c-rt:forEach>
</select>
</td></tr>
<tr><th>Agent</th><td colspan="3"><input size="50" type="text" name="agent" value="${supplier.agent}" maxlength="100"/>最多100个字</td>
	</tr><tr>
	<th>区域</th><td colspan="3">
	<select name="area">
	<c-rt:forEach items="${areas }" var="area">
	<option value="${area.code}" <c-rt:if test="${area.code==supplier.area }">selected="selected"</c-rt:if>>${area.name }</option>
	</c-rt:forEach>
	</select>
	</td>
</tr>
<tr><th>Incoterm</th><td>
	<select name="incoterm">
		<option value="">please select</option>
		<c-rt:forEach items="${incoterms }" var="incoterm">
			<option value="${incoterm.code }" <c-rt:if test="${incoterm.code==supplier.incoterm }">selected="selected"</c-rt:if>>${incoterm.name }</option>
		</c-rt:forEach>
	</select>
	</td>
</tr>
<c-rt:if test="${empty supplier}">
<tr><th><span style="color:red">*</span>开户银行</th><td><input size="50" id="bankName" name="bankName" type="text" value="${supplier.bankName}" maxlength="50"/>最多50个字</td>
	<th><span style="color:red">*</span>开户名称</th><td><input size="50" id="bankAccountName" name="bankAccountName" type="text" value="${supplier.bankAccountName}" maxlength="50"/>最多50个字</td>
</tr>
<tr><th><span style="color:red">*</span>银行账号</th><td><input size="40" id="bankAccountNum" name="bankAccountNum" type="text" value="${supplier.bankAccountNum}" maxlength="100"/>最多100个字</td>
	<th><span style="color:red">*</span>付款银行所在地</th>	<td><s:select id="paymentBankArea" name="paymentBankArea" list="paymentBankAreaMenu.options" listKey="key"  listValue="value.name" headerKey="" headerValue="---请选择---"/></td>
</tr>
</c-rt:if>
<c-rt:if test="${!empty supplier}">
<tr><th>开户银行</th><td>${supplier.bankName}</td>
	<th>开户名称</th><td>${supplier.bankAccountName}</td>
</tr>
<tr><th>银行账号</th><td>${supplier.bankAccountNum}</td>
	<th>付款银行所在地</th>	<td>${paymentBankAreaMenu.options[supplier.paymentBankArea].name}</td>
</tr>
</c-rt:if>

<tr><th>审核状态</th><td>${pu:menuOption('Supplier.approveStatus', pu:toString(supplier.approveStatus)).name}</td>
	<!-- <tr><th>审核员</th><td><input type="text" readonly="readonly" name="approveBy" id="approveBy" value="${supplier.approveBy}"/><a href="javascript:doAR('<%=application.getContextPath() %>/supplierApply/page.do?iamlazy=userList&AJAX=true&refreshZone=dialog&returnFieldIds=approveBy','dialog');openDialog('select')">select</a></td></tr>-->
	<th>审核员</th><td>${supplier.approveBy}</td>
</tr>
<tr><th>状态</th><td colspan="3">${pu:menuOption('Supplier.status', pu:toString(supplier.status)).name}</td></tr>
<tr><th valign="top">备注</th><td valign="top" colspan="3"><textarea name="memo">${supplier.memo}</textarea></td></tr>

	<tr>
	<th></th><td colspan="3"><input type="button" id="submit_button" value="送出"/>
	<input type="reset" value="Cancel"/>
	<c-rt:if test="${!empty param.operation}">
		<c-rt:if test="${empty supplier}">
		<span style="color:red">已储存！</span>
		</c-rt:if>
		<c-rt:if test="${!empty supplier}">
		<span style="color:red">已储存修改！</span>
		</c-rt:if>
		
	</c-rt:if>
	</td>
	</tr>
	
	</table>
</form>

